import javax.annotation.processing.SupportedAnnotationTypes;
import java.util.Random;
import java.util.Scanner;

public class Test {
    public static void main8(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        for (int i = 0; i <= n ; i++) {
            int tmp = i;
            int count = 0;//位数
            int sum = 0;
            while (tmp != 0){
                count++;
                tmp /= 10;
            }
            tmp = i;
            while (tmp != 0){
                sum += Math.pow(tmp % 10,count);
                tmp /= 10;
            }
            if (sum == i){
                System.out.println(i);
            }

        }
    }
    public static void main7(String[] args) {
        Scanner scan = new Scanner(System.in);
        int input = scan.nextInt();
        while (input != 0){
            System.out.print((input % 10)+" ");
            input /= 10;
        }
    }
    public static void main6(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("请输入操作数：");
        int num = scan.nextInt();
        int tmp1 = num;
        int tmp2 = (num >> 1);
        System.out.print("奇数位：");//从右向左数
        while (tmp1 != 0){
            int ret = tmp1 & 1;
            tmp1 >>= 2;
            System.out.print(ret+" ");
        }
        System.out.println();
        System.out.print("偶数位：");
        while (tmp2 != 0){
            int ret = tmp2 & 1;
            tmp2 >>= 2;
            System.out.print(ret+" ");
        }
    }
    public static void main5(String[] args) {
        String password = "0";
        String realPassword = "abcdef";
        int count = 1;//输入次数
        Scanner scan = new Scanner(System.in);
        do{
            System.out.print("请输入密码：");
            password = scan.nextLine();
            if(password.equals(realPassword)){
                System.out.println("登录成功");
                break;
            }
            else{
                System.out.println("密码错误");
                count++;
            }
        }while(count <= 3);
        if(count == 4){
            System.out.println("退出程序");
        }
    }
    public static void main4(String[] args) {
        int input = 0;
        Scanner scan = new Scanner(System.in);
        do{
            System.out.println("------------------");
            System.out.println("---猜    数   字---");
            System.out.println("------------------");
            System.out.println("-     1.Play     -");
            System.out.println("------------------");
            System.out.println("-     0.Exit     -");
            System.out.println("------------------");
            System.out.println("请选择：");
            input = scan.nextInt();
            switch(input){
                case 1:
                    Random random = new Random();
                    int randomNum = random.nextInt(100);//[0,100)
                    while(true){
                        System.out.println("请输入数字：");
                        int num = scan.nextInt();
                        if (num < randomNum){
                            System.out.println("猜小了");
                        }
                        else if (num > randomNum){
                            System.out.println("猜大了");
                        }
                        else{
                            System.out.println("猜对了");
                            break;
                        }
                    }

                    //System.out.println(randomNum);
                    break;
                case 0:
                    System.out.println("退出游戏");
                    break;
                default:
                    System.out.println("输入错误");
                    break;
            }

        }while(input != 0);
    }
    public static void main3(String[] args) {
        int n = 0;
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        int i = 0;
        for (i = 1;i <= n;i++){

        }
    }
    public static void main2(String[] args) {
        int input = 0;
        boolean flg = true;//true表示素数，false表示不是素数
        Scanner scan = new Scanner(System.in);
        input = scan.nextInt();
        for (int i = 2; i <= Math.sqrt(input); i++) {
            if(input % i == 0){
                flg = false;
                System.out.println(input+"不是素数");
                break;
            }
        }
        if(flg){
            System.out.println(input+"是素数");
        }
    }
    public static void main1(String[] args) {
        int i = 0;
        int count = 0;
        for (i = 1;i <= 100;i++){
            if(i % 10 == 9){
                count++;
            }
            if (i/10 == 9){
                count++;
            }
        }
        System.out.println("1~100之间出现9的个数："+count);
    }
}
